home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / pubpoint_dialog.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  13.1 KB  |  426 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="include/wmsConstants.inc"-->
  3. <!--#include file="include/wmsLocStrings.inc"-->
  4. <!--#include file="include/wmsCommon.inc"-->
  5. <!--#include file="include/wmsHeader.inc"-->
  6. <!--#include file="include/wmsError.inc"-->
  7. <!--#include file="include/wmsServerHash.inc"-->
  8. <!--#include file="include/wmsconnect.inc"-->
  9. <!--#include file="include/wmsHelp.inc"-->
  10. <% 
  11. '+-------------------------------------------------------------------------
  12. '
  13. '  Microsoft Windows Media
  14. '  Copyright (C) Microsoft Corporation. All rights reserved.
  15. '
  16. '  File:       PubPoint_Dialog.asp
  17. '
  18. '  Contents:
  19. '
  20. '--------------------------------------------------------------------------
  21.  
  22. ConnectToServer
  23. ConnectToPubPoint
  24.  
  25. on error resume next
  26.  
  27. Dim strPageTitle
  28. Dim szErrorDescription
  29. Dim bOpIsRename
  30. Dim bError
  31. Dim strOldName
  32. Dim strNewName
  33. Dim strHelpTopic
  34. Dim strOp
  35. Dim dwPPType
  36.  
  37. strOp = RemoveDangerousCharacters( qs("op") )
  38. strNewName = SafeUnescape( trim( qs("newPPName") ) )
  39. strOldName = SafeUnescape( g_strEncodedPubPointName )
  40.  
  41. dwPPType = g_objPubPoint.Type
  42.  
  43. if( 0 = StrComp( "/", strOldName, vbTextCompare ) ) then
  44.     if( WMS_PUBLISHING_POINT_TYPE_BROADCAST = dwPPType ) then
  45.         strOldName = L_DEFAULTPLAIN_TEXT
  46.     else
  47.         strOldName = L_DEFAULTPLAIN_TEXT
  48.     end if
  49. end if
  50.  
  51. bError = FALSE
  52.  
  53. if( 0 = StrComp( "rename", strOp, vbTextCompare ) ) then
  54.     if( WMS_PUBLISHING_POINT_TYPE_BROADCAST = dwPPType ) then
  55.         dwBroadcastStatus = g_objPubPoint.BroadcastStatus
  56.         if( ( WMS_BROADCAST_PUBLISHING_POINT_STARTED and dwBroadcastStatus ) or ( WMS_BROADCAST_PUBLISHING_POINT_STARTED_WITHOUT_DATA and dwBroadcastStatus ) ) then
  57.             Response.Redirect( "../alert.asp?server=" & g_strQueryStringServer & "&ppID=" & qs("ppID") & "&path=" & Server.URLEncode( "/wmssecure/pages/pubpoints/pubpoint_collection.asp" ) & "&op=" & OP_RENAME_STARTED_PUBPOINT )
  58.             Response.Flush
  59.             Response.End
  60.         end if
  61.     end if
  62.     bOpIsRename = TRUE
  63.     strHelpTopic = H_PPRENAMETOPIC
  64. else
  65.     bOpIsRename = FALSE
  66.     strHelpTopic = H_PPDUPLICATETOPIC
  67. end if
  68.  
  69. if( "" <> strNewName ) then
  70.     if( 0 = StrComp( strNewName, L_DEFAULTPLAIN_TEXT, vbTextCompare ) ) then
  71.         strNewName = "/"
  72.     else
  73.         if ( ( WMS_PUBLISHING_POINT_TYPE_BROADCAST = dwPPType ) and ( 0 = StrComp( strNewName, L_DEFAULTBC_TEXT, vbTextCompare ) ) ) then
  74.             strNewName = "/"
  75.         elseif( 0 = StrComp( strNewName, L_DEFAULTOD_TEXT, vbTextCompare ) ) then
  76.             strNewName = "/"
  77.         end if        
  78.     end if
  79.     
  80.     if bOpIsRename then
  81.         Session( "bUpdateTreeView" ) = TRUE
  82.         if PPNameIsLegal( strNewName ) then
  83.             g_objPubPoint.Name = strNewName
  84.         end if
  85.     else
  86.         Session( "bUpdateTreeView" ) = TRUE
  87.         g_objServer.PublishingPoints.Clone strNewName, g_objPubPoint
  88.     end if
  89.  
  90.     if( ErrorDetected( "name" ) ) then
  91.         bError = TRUE
  92.         Session( "PageReloadedToDisplayError" ) = 1
  93.     else
  94.         Server.Transfer( "pubpoint_collection.asp" )
  95.     end if
  96. end if
  97.  
  98. '/////////////////////////////////////////////////////////////////////
  99. Function PPNameIsLegal( strPubPointName )
  100.     PPNameIsLegal = TRUE
  101.     Dim regEx
  102.     Set regEx = New RegExp
  103.     regEx.Pattern = "/\<|\>|\\|\?|%|&|\#|\{|\}|\||\^|\[|\]|\`|\f|\n|\r/gi"
  104.     regEx.IgnoreCase = TRUE
  105.     regEx.Global = TRUE
  106.     regEx.Multiline = TRUE
  107.     if( TRUE = regEx.Test( strPubPointName ) ) then
  108.         PPNameIsLegal = FALSE
  109.         Exit Function
  110.     end if
  111. End Function
  112.  
  113. '//////////////////////
  114. '   Populate the page
  115. '//////////////////////
  116.  
  117. if( bOpIsRename ) then
  118.     strPageTitle = L_RENAMEPUBPT_TEXT
  119. else
  120.     strPageTitle = L_DUPLICATEPUBPT_TEXT
  121. end if
  122.  
  123. strNewName = ""
  124.  
  125. if( 0 = Len( strOldName ) ) then
  126.     strOldName = SafeUnescape( g_strPubPointName )
  127. end if
  128.  
  129. szErrorDescription = CStr( qs( "error" ) )
  130.  
  131. '///////////////////////////////////////////////////////////
  132. Function NormalizePPName( strPPName )
  133.     if( "/" = strPPName ) then
  134.         NormalizePPName = Server.HTMLEncode( L_DEFAULTPPNAME_TEXT )
  135.     else
  136.         NormalizePPName = g_strPubPointName
  137.     end if
  138. End Function
  139.  
  140. '////////////////////////////////////////////////////////////////
  141. Function CreateNewPPName( strPPName )
  142.     Dim strTemplate
  143.     Dim strResult
  144.     strTemplate = L_COPYOFPPTEMPL_TEXT
  145.     strResult = CStr( Replace( strTemplate, "___", strPPName, 1 ) )
  146.     CreateNewPPName = strResult
  147. End Function
  148.  
  149. WriteHTMLHeader( strPageTitle )
  150. %>
  151. <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
  152. <script language="JavaScript" src="include/WMSCommon.js"></script>
  153. <script language="JavaScript">
  154. <!--
  155. /*@cc_on @*/
  156. var g_bNameAlerted;
  157. g_bNameAlerted = false;
  158.  
  159. <% WriteCommonJSUtils %>
  160.  
  161. var dbgNumFilterWarnings = 0;
  162. function InitFilters()
  163. {
  164.     <% jsTRY %>
  165.     dbgNumFilterWarnings = 0;
  166.     var szNewPPName;
  167.     szNewPPName = new String( document.theForm.newPPName.value );
  168.     document.theForm.newPPName.focus();
  169.     if( 0 >= szNewPPName.length )
  170.     {
  171.         return;
  172.     }
  173.     else
  174.     {
  175.         document.theForm.newPPName.disabled = false;
  176.         document.theForm.newPPName.focus();
  177.     }
  178.  
  179.     var szOriginalPPName;
  180.     szOriginalPPName = new String( "<%= ucase( strOldName ) %>" );
  181.     if( szNewPPName.toUpperCase() == szOriginalPPName )
  182.     {
  183.         document.theForm.submit.disabled = true;
  184.     }
  185.  
  186.     <% if "" <> qs("error") then %>
  187.     HandleError();
  188.     <% end if %>
  189.     <% jsCATCH %>
  190. }
  191.  
  192. //////////////////////////////////////////////////////////////////////////
  193. function ValidatePPName()
  194. {
  195.     <% jsTRY %>
  196.     var szName;
  197.     var bCanBeEnabled;
  198.     var bValidName;
  199.     var szIllegalPPNameChars;
  200.     var i;
  201.     
  202.     bCanBeEnabled = true;
  203.     szName = new String( document.theForm.newPPName.value );
  204.     if( 0 == szName.length )
  205.     {
  206.         bCanBeEnabled = false;
  207.     }
  208.  
  209.     // perform left trim
  210.     szName = szName.replace( /^\s+/, "" );
  211.  
  212.     // perform right trim
  213.     szName = szName.replace( /\s+$/, "" );
  214.  
  215.     if( ( 0 == szName.length ) || ( "<%= EscBackslashChar( ucase( strOldName ) ) %>" == szName.toUpperCase() ) )
  216.     {
  217.         bCanBeEnabled = false;
  218.     }
  219.     
  220.     szIllegalPPNameChars = "<>\\?%&#{}|^[]`*\"";
  221.     bValidName = true;
  222.     
  223.     for( i=0; i < szName.length; i++ )
  224.     {
  225.         if( -1 != szIllegalPPNameChars.indexOf( szName.charAt( i ) ) )
  226.         {
  227.             bValidName = false;
  228.             break;
  229.         }
  230.     }
  231.     
  232.     if( false == bValidName )
  233.     {
  234.         if( false == g_bNameAlerted )
  235.         {
  236.             g_bNameAlerted = true;
  237.             window.alert( "<%= L_INVALIDCHARSINNAME_TEXT %>" + "\"" );
  238.             document.theForm.newPPName.focus();
  239.         }
  240.         document.theForm.newPPName.style.color = "#ff0000";
  241.         document.theForm.submit.disabled = true;
  242.         window.status = szIllegalPPNameChars;
  243.     }
  244.     else
  245.     {
  246.         document.theForm.newPPName.style.color = "#000000";
  247.         document.theForm.submit.disabled = ! bCanBeEnabled;
  248.         window.status = "";
  249.     }
  250.     <% jsCATCH %>
  251. }
  252.  
  253. ///////////////////////////////////////////////////////////////////////
  254. function HandleError()
  255. {
  256.     <% jsTRY %>
  257.     <% if( "duplicate" = szErrorDescription ) then %>
  258.     window.alert("<%= RemoveDangerousCharacters( g_strDecodedServerName & L_DUPLICATENAME_TEXT ) %>");
  259.     <% elseif( "hostnotavailable" = szErrorDescription ) then %>
  260.     window.alert("<%= RemoveDangerousCharacters( g_strDecodedServerName & L_BADHOSTNAME_TEXT ) %>");
  261.     <% elseif( "nowms" = szErrorDescription ) then %>
  262.     window.alert("<%= RemoveDangerousCharacters( g_strDecodedServerName & L_NOWMS_TEXT ) %>");
  263.     <% elseif( "serviceerror" = szErrorDescription ) then %>
  264.     window.alert("<%= RemoveDangerousCharacters( g_strDecodedServerName & L_SERVICEINERROR_TEXT ) %>");
  265.     <% else %>
  266. //    document.location.replace( "pubpoint_collection.asp" );
  267.     <% end if %>
  268.     <% jsCATCH %>
  269. }
  270.  
  271.  
  272. ///////////////////////////////////////////////////////////////////////
  273. function Cancel()
  274. {
  275.     <% jsTRY %>
  276.     document.location.replace( "pubpoint_collection.asp?server=<%= g_strQueryStringServer %>&ppID=<%= g_strPubPointID %>" );
  277.     <% jsCATCH %>
  278. }
  279.  
  280.  
  281. ///////////////////////////////////////////////////////////////////////
  282. function ValidateInput()
  283. {
  284.     <% jsTRY %>
  285.     var strOldName;
  286.     var newPPName;
  287.  
  288.     if( document.theForm.submit.disabled )
  289.     {
  290.         event.cancelBubble=1;
  291.         return false;
  292.     }
  293.     <% jsCATCH %>
  294. }
  295. -->
  296. </script>
  297. </head>
  298. <body bgcolor="<%= colorTabLight %>" topmargin=10 leftmargin=10 rightmargin=10 marginwidth=10 marginheight=10 onload="JavaScript:InitFilters();" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
  299. <% BeginErrorHandling %>
  300.  
  301. <form name="theForm" method="get" onsubmit="JavaScript:return( ValidateInput() );" AUTOCOMPLETE="OFF">
  302. <input type="hidden" name="server" value="<%= g_strQueryStringServer %>">
  303. <input type="hidden" name="ppID" value="<%= g_strPubPointID %>">
  304. <input type="hidden" name="op" value="<%= strOp %>">
  305. <table cellspacing="0" cellpadding="4" <% if brMSIE = g_dwBrowserType then %>class="dialogframe" <% else %> bgcolor="lightgrey" <% end if %> border=3><tr><td>
  306. <table width=100% cellspacing=5 cellpadding="0" cols=3 border="0">
  307. <tr>
  308.     <td width=40 valign="middle" align="left">
  309. <% if bOpIsRename then %>
  310.         <img src="img/rename_icon32.gif" valign="middle" width=32 height="32">
  311. <% else %>
  312.         <img src="img/duplicateppt_icon32.gif" valign="middle" width=32 height="32">
  313. <% end if %>
  314.     </td>
  315.     <td valign="bottom" align="left" class="header">
  316. <% if bOpIsRename then %>
  317.         <%= Server.HTMLEncode( L_RENAMEPUBPT_TEXT ) %>
  318. <% else %>
  319.         <%= Server.HTMLEncode( L_DUPLICATEPUBPT_TEXT ) %>
  320. <% end if %>
  321.     </td>
  322. </tr>
  323. </table>
  324. <table width="100%" cellspacing="1" cellpadding="1" border="0">
  325. <tr>
  326.     <td width="32">
  327.          
  328.     </td>
  329.     <td align="left" valign="middle">
  330.     </td>
  331. </tr>
  332. <tr>
  333.     <td class="defaultcursor" colspan="2">
  334.         <%= Server.HTMLEncode( L_PPNAMECOLON_TEXT ) %>
  335.     </td>
  336. </tr>
  337. <tr>
  338.     <td align="left" colspan="2">
  339.            <input 
  340.             type="text" 
  341.             size=<% if brMSIE = g_dwBrowserType then %>"32" <% else %>"64" <% end if %>
  342.             maxlength="<%= Server.HTMLEncode( MAX_LEN_PPNAME ) %>"
  343.             name="newPPName" 
  344.             tabindex="1" <%
  345.         if bOpIsRename then %>
  346.             value="<% if( 0 = Len( strNewName ) ) then Response.Write( Server.HTMLEncode( strOldName ) ) else Response.Write( Server.HTMLEncode( strNewName ) ) end if %>"
  347.         <% else %>
  348.             value="<% 
  349.             if( 0 = Len( strNewName ) ) then 
  350.                 strCopyName = CreateNewPPName( strOldName )
  351.                 Response.Write( Server.HTMLEncode( strCopyName ) )
  352.             else 
  353.                 Response.Write( Server.HTMLEncode( strNewName ) )
  354.             end if %>"<%
  355.         end if %>
  356.             onKeyUp="JavaScript:ValidatePPName();"
  357.             onKeyDown="JavaScript:ValidatePPName();"
  358.             onChange="JavaScript:ValidatePPName();"
  359.             onPaste="JavaScript:ValidatePPName();"
  360.             AUTOCOMPLETE="OFF"
  361.             >
  362.     </td>
  363.     <td width="32">
  364.          
  365.     </td>
  366. </tr>
  367. <% if bOpIsRename then %>
  368. <tr>
  369.     <td>
  370.          <br>
  371.         <table class="defaultcursor" width="100%" cellspacing="2" cellpadding="2" border="1" cols="3">
  372.         <tr>
  373.             <td align="left">
  374.                 <table class="defaultcursor" width="100%" cellspacing="2" cellpadding="2" border="0" cols="3">
  375.                 <tr>
  376.                     <td align="left" width="32">
  377.                         <img src="img/wmstip_32.gif" height="32" width="32">
  378.                     </td>
  379.                     <td align="left">
  380.                         <span class="helptext"><%= Server.HTMLEncode( L_RENPPWARN_TEXT ) %></span>
  381.                     </td>
  382.                     <td align="right">
  383.                          
  384.                     </td>
  385.                 </tr>
  386.                 </table>
  387.             </td>
  388.         </tr>
  389.         </table>
  390.     </td>
  391. </tr>
  392. <% end if %>
  393. </table>
  394. <p>
  395. <table cellspacing="4" cellpadding="0" border="0">
  396. <tr>
  397.     <td align=left>
  398.         <input type=submit name="submit" onclick="JavaScript:ValidateInput();" tabIndex=2 value="<%= Server.HTMLEncode( L_OKAYBUTTON_TEXT ) %>">
  399.     </td>
  400.     <td align=left>
  401.         <input class="button" name="cancel" onclick="JavaScript:Cancel();" tabIndex=3 type=button value="<%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>"> 
  402.     </td>
  403.     <td align=left>
  404.         <input class="button" name="help" onclick="JavaScript:DoHelp( '<%= H_PPLEVEL %>','<%= strHelpTopic %>' );" tabIndex="4" type=button value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>"> 
  405.     </td>
  406.     <td align=left>
  407.          
  408.     </td>
  409. </tr>
  410. </table>
  411. </td></tr></table>
  412.  
  413. </form>
  414. <% 
  415. AlertUserWithPopupErrorDialog
  416. OnErrorGoBack 
  417. %>
  418. </body>
  419. </html>
  420. <% 
  421. EndErrorHandling "pubpoint_dialog.asp" 
  422.  
  423. on error resume next
  424. WMSServerHashASPCleanup
  425. WMSConnectASPCleanup
  426. %>